package com.ruoyi.procurement.design.handler;

import com.ruoyi.procurement.design.ProcurementStateEnum;
import com.ruoyi.procurement.design.ProcurementStateHandlerAbs;
import com.ruoyi.procurement.domain.ProcurementOrder;
import com.ruoyi.procurement.mapper.ProcurementOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 审核通过状态流转
 */
@Component
public class ProcurementApproveHandler extends ProcurementStateHandlerAbs {

    @Override
    public String get() {
        return ProcurementStateEnum.APPROVED.getCode();
    }

    @Autowired
    private ProcurementOrderMapper procurementOrderMapper;

    @Override
    public Integer transferTo(ProcurementOrder procurementOrder, String state) {
        procurementOrder.setProcurementStatus(state);
        procurementOrder.setAuditTime(new Date());
        return procurementOrderMapper.updateProcurementOrder(procurementOrder);
    }

    @Override
    public void operationWareHousing(ProcurementOrder procurementOrder) {

    }
}
